home *** CD-ROM | disk | FTP | other *** search
/ PD ROM 1 / PD ROM Volume I - Macintosh Software from BMUG (1988).iso / Stacks / Updates⁄New / TEXAS for BMUG / C progs / brwsr.2 ƒ / brwsr.h < prev    next >
Encoding:
C/C++ Source or Header  |  1987-11-03  |  3.1 KB  |  87 lines  |  [TEXT/KAHL]

  1. /* some definitions for the brwsr program...
  2.  * 870805-07-... ^z
  3.  */
  4.  
  5. /* tell the compiler that we are using Lightspeed C ... mostly so that
  6.  * certain sections of non-transportable code will be activated to
  7.  * compensate for the use of 16-bit int variables in LSC.... */
  8. #define LIGHTSPEED
  9.  
  10. /* KEY_LENGTH is the number of letters we have in each record.... must
  11.  * agree with the value used in qndxr to build the index!.... */
  12. #define KEY_LENGTH    28
  13.  
  14. /* CONTEXT_LINE_LENGTH is the total length of a key-word-in-context
  15.  * display line.... */
  16. #define CONTEXT_LINE_LENGTH  75
  17.  
  18. /* CONTEXT_OFFSET is the distance from the start of the context line
  19.  * to where the key word itself begins.... */
  20. #define CONTEXT_OFFSET  30
  21.  
  22. /* STRLEN is the most characters to allow in a line from the
  23.  * file at one time, and the maximum length of a command line.... */
  24. #define STRLEN  256
  25.  
  26. /* NEIGHBORHOOD is the distance in bytes that defines the proximity
  27.  * neighborhood of a word in the index ... used when defining a
  28.  * subset for proximity searching.... NEIGHBORHOOD * 8 is the
  29.  * compression factor for squeezing the document file down into the
  30.  * array subset[] ...
  31.  * Thus, NEIGHBORHOOD = 32, a good choice, defines a chunkiness of 32
  32.  * characters in making comparisons for proximity determination purposes....
  33.  */
  34. #define NEIGHBORHOOD  32
  35.  
  36. /* WORD_RANGE, SENTENCE_RANGE, and PARAGRAPH_RANGE define how many chunks
  37.  * of size NEIGHBORHOOD on each side of an item that the neighborhood of
  38.  * each type extends.  Values 1, 10, and 100 work pretty well....
  39.  */
  40. #define WORD_RANGE         1
  41. #define SENTENCE_RANGE    10
  42. #define PARAGRAPH_RANGE  100
  43.  
  44. /* define a value to help recognize long operations, for which
  45.  * the user should be warned of a likely delay in response ...
  46.  */
  47. #define GIVE_WARNING  200
  48.  
  49. /* structure of the records in the index key file:
  50.  *    a fixed-length character string kkey, filled out with blanks and
  51.  *        containing the unique alphanumeric 'words' in the document file,
  52.  *        changed to all-capital letters;
  53.  *    a cumulative count of how many total occurrences of words, including
  54.  *        the current one, have happened up to this point in the alphabetized
  55.  *        index.
  56.  *
  57.  *    Obviously, the number of occurrences of the nth word is just the
  58.  *        difference between the nth cumulative count and the (n-1)th
  59.  *        cumulative count.  Also, the (n-1)th cumulative count is a
  60.  *        pointer to the first occurrence of the nth word in the ptr_file
  61.  *        (which holds all the index offset pointers for the document file).
  62.  *
  63.  *    See the index building program "ndxr.c" for further details of the
  64.  *        index structure....
  65.  */
  66. typedef struct
  67.   {
  68.     char kkey[KEY_LENGTH];
  69.     long ccount;
  70.   }  KEY_REC;
  71.  
  72. /* the pointer records are simply long integers, offsets from the start
  73.  * of the document to the indexed words....*/
  74. #define PTR_REC  long
  75.  
  76. /* define the values for the three levels that the user may be browsing
  77.  * on:  INDEX is the display of unique words and their occurrence counts;
  78.  * CONTEXT is the key-word-in-context (KWIC) display; TEXT is the full
  79.  * text of the document.  */
  80. #define INDEX    0
  81. #define CONTEXT  1
  82. #define TEXT     2
  83.  
  84. /* symbolic values for yes/no answers... */
  85. #define TRUE  1
  86. #define FALSE 0
  87.